# coding=utf-8

import json

text_new = ''
with open("city.json","r",encoding='UTF-8') as f:
    text_new = f.read()
# print(text_new)
pp = json.loads(text_new)
pid = '86'
provinces = pp[pid]
for province in provinces:
    str = 'INSERT INTO `area_data`(`id`, `name`, `parent_id`) VALUES('+province+', \''+provinces[province]+ '\',' + pid + ');'
    #print(str)
    citys = pp[province]
    for city in citys:
        str = 'INSERT INTO `area_data`(`id`, `name`, `parent_id`) VALUES(' + city + ', \'' + citys[
            city] + '\',' + province + ');'
        print(str)
        qus = pp.get(city)
        if(qus):
            for qu in qus:
                str = 'INSERT INTO `area_data`(`id`, `name`, `parent_id`) VALUES(' + qu + ', \'' + qus[
                    qu] + '\',' + city + ');'
                print(str)